package com.zy.基础.文件读取

import java.io.{File, PrintWriter}
import scala.io.{BufferedSource, Source}

object Test {
  def main(args: Array[String]): Unit = {
    // 读取文件
    val source: BufferedSource = Source.fromFile("src/main/resources/file.txt")
    source.foreach(print)

    // 写出文件(scala无写出类，可以无缝调用java接口)
    val writer = new PrintWriter(new File("src/main/resources/fileOut.txt"))
    writer.write("123213213\n");
    writer.write("哈哈哈")
    writer.close()
  }
}
